﻿using SimpleExpression;
namespace SimpleExpression
{
    /// <summary>
    /// Esta clase no tiene nada relacionado a DbCommand puede ser utilizada para el xml
    /// </summary>
    public class SelectPlan : QueryPlanBase
    {
        private ISelectCommandStrategy strategy;


		/// <summary>
		/// Initializes a new instance of the <see cref="SelectPlan"/> class.
		/// </summary>
		/// <param name="entityExpression">The entity expression.</param>
		/// <param name="strategy">The strategy.</param>
        public SelectPlan(EntityExpression entityExpression, ISelectCommandStrategy strategy)
        {
            this.EntityExpression = entityExpression;
            this.strategy = strategy;
            this.ExpressionVisitor = new SelectVisitor(this.strategy);
        }

        public override object Command
        {
            get
            {
                if (this.strategy.Command == null || this.strategy.Command.ToString().Length == 0)
                    base.GetResult();

                return this.strategy.Command;
            }
        }
    }
}